import Vue from 'vue'
import router from './router'
import store from './store'
import vue from './Vue.vue'

import Element, { MessageBox } from "element-ui";
import 'element-ui/lib/theme-chalk/index.css'

import './assets/styles/element-variables.scss'
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css

// 富文本组件()
import Editor from "@/components/Editor"
import global from './global.js'
import Cookies from 'js-cookie'
import './assets/icons' // icon下的index.js
import useComponent from './utils/useComponent'
import vant from './api/vant'
import plugins from './plugins' // plugins
import directive from './directive' // directive
import { toRoute } from "@/layout/components/Sidebar/goToRoute";
import {http_Get,http_Post,http_PostUp} from './utils/request.js'
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
import { getDicts } from "@/api/system/dict/data";


import DictData from '@/components/DictData'
import Pagination from "@/components/Pagination";
import RightToolbar from "@/components/RightToolbar"
import DictTag from '@/components/DictTag'

Vue.config.productionTip = false
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.Global=global;
Vue.prototype.$toRoute=toRoute;
Vue.prototype.$httpGet=http_Get;
Vue.prototype.$httpPost=http_Post;
Vue.prototype.$httpPostUp=http_PostUp;
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.handleTree = handleTree
Vue.prototype.getDicts = getDicts

Vue.component('Editor', Editor)
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('DictTag', DictTag)

// 引入useComponent文件，进行注册插件，可以一次注册多个
Vue.use(useComponent)

Vue.use(vant)
Vue.use(plugins)
Vue.use(Cookies)
Vue.use(directive)
// 字典数据组件
DictData.install()



/*//按需导入组件   但是这样有一些傻逼组件（scrollbar）无法加载   我真的使服了    2023/2/25
import element from './api/element'
Vue.use(element)*/

// 全局引入组件
Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

new Vue({
  router,
  store,
  render: h => h(vue)
}).$mount('#app01')
/*
* 把vue组件通过main.js映射到index.html上
* */
